import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '领用时间',
    align: "center",
    sorter: true,
    dataIndex: 'usedDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '出库领用人',
    align: "center",
    dataIndex: 'outPerson'
  },
  {
    title: '归还人',
    align: "center",
    dataIndex: 'putPerson'
  },
  {
    title: '用途',
    align: "center",
    dataIndex: 'purpose'
  },
  {
    title: '归还日期',
    align: "center",
    dataIndex: 'returnDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '确认人',
    align: "center",
    dataIndex: 'confirmPerson'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "领用时间",
    field: "usedDate",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "出库领用人",
    field: 'outPerson',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "归还人",
    field: 'putPerson',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "归还日期",
    field: "returnDate",
    component: 'RangePicker',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '领用时间',
    field: 'usedDate',
    component: 'DatePicker',
  },
  {
    label: '出库领用人',
    field: 'outPerson',
    component: 'Input',
  },
  {
    label: '归还人',
    field: 'putPerson',
    component: 'Input',
  },
  {
    label: '用途',
    field: 'purpose',
    component: 'InputTextArea',
  },
  {
    label: '归还日期',
    field: 'returnDate',
    component: 'DatePicker',
  },
  {
    label: '确认人',
    field: 'confirmPerson',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
